package org.flatshare.entity;

import java.util.GregorianCalendar;
import java.util.Calendar;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: Invoice
 *
 */
@Entity
@Table(name = "invoice")
@NamedQueries( {
@NamedQuery(name = "findAllInvoices", query = "select i from Invoice i"),
@NamedQuery(name = "findByIdInvoices", query = "select i from Invoice i  where i.id = :id"),
@NamedQuery(name = "findByTypeInvoices", query = "select i from Invoice i  where i.type = :type")	})


public class Invoice implements Serializable {

	
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column(name="id", unique=true, nullable = false, insertable=true, table="invoice", updatable=true)
	private String id;

	@Column(name="type", unique=false, nullable = false, insertable=true, table="invoice", updatable=true)
	private String type;
	
	@Column(name="amount", unique=false, nullable = false, insertable=true, table="invoice", updatable=true)
	private float amount;
	
	@Column(name="startDate", unique=false, nullable = false, insertable=true, table="invoice", updatable=true)
	@Temporal(TemporalType.DATE)
	private GregorianCalendar startDate;
	
	@Column(name="endDate", unique=false, nullable = false, insertable=true, table="invoice", updatable=true)	
	@Temporal(TemporalType.DATE)
	private GregorianCalendar endDate;
	
	@ManyToMany
	@JoinTable(name= "inv_rom",
				joinColumns = @JoinColumn(name="invoice_fk"),
				inverseJoinColumns = @JoinColumn(name= "roomer_fk"))
	private List<Roomer> roomers;
	
	
	public List<Roomer> getRoomers() {
		return roomers;
	}

	public void setRoomers(List<Roomer> roomers) {
		this.roomers = roomers;
	}

	public Invoice() {
		super();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public float getAmount() {
		return amount;
	}

	public void setAmount(float amount) {
		this.amount = amount;
	}

	public GregorianCalendar getStartDate() {
		return startDate;
	}

	public void setStartDate(GregorianCalendar startDate) {
		this.startDate = startDate;
	}

	public GregorianCalendar getEndDate() {
		return endDate;
	}

	public void setEndDate(GregorianCalendar endDate) {
		this.endDate = endDate;
	}
	
	
   
}
